package com.yingpai.fitness.dvp_2_0.main.activity.mine.integral;

import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.TextView;

import com.lzy.okgo.model.Response;
import com.yingpai.fitness.R;
import com.yingpai.fitness.dvp_2_0.common.activity.CommonActivity;
import com.yingpai.fitness.dvp_2_0.common.finalokgo.callback.Callback;
import com.yingpai.fitness.dvp_2_0.common.finalokgo.request.RequestType;
import com.yingpai.fitness.dvp_2_0.common.util.constant.Contacts;
import com.yingpai.fitness.dvp_2_0.main.bean.integral.IntegralRuleBean;
import com.yingpai.fitness.dvp_2_0.main.util.constant.Constant;
import com.yingpai.fitness.dvp_2_0.main.util.constant.Url;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by ASUS on 2018/12/17.
 */

public class IntegralRuleActivity extends CommonActivity {
    @BindView(R.id.text)
    TextView text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setStatusFlag(Contacts.NORMAL_STATUS);
        setContentView(R.layout.dvp_2_0_activity_integral);
    }

    @Override
    protected void initView() {
        setTitle("规则说明");

        text.setMovementMethod(ScrollingMovementMethod.getInstance());
    }

    @Override
    protected void initData() {
        showDialog(this,null);
        finalOkGo.requestEncrypt(RequestType.POSTENCRYPT, Contacts.HOST_SERVER + Url.INTEGRAL_RULE, null, Url.INTEGRAL_RULE, new Callback<IntegralRuleBean>() {
            @Override
            public void onSuccess(IntegralRuleBean integralRuleBean) {
                if(integralRuleBean.getCode().equals(Constant.REQUEST_SUCCESS_0)){
                    text.setText(integralRuleBean.getData().getRule());
                }else{
                    showToast(integralRuleBean.getMessage()+"");
                }
                dismissDialog();
            }

            @Override
            public void onError(Response<String> response) {
                super.onError(response);
                dismissDialog();
            }
        });
    }

    @Override
    @OnClick({})
    public void onViewClicked(View view) {
        super.onViewClicked(view);
        switch (view.getId()) {
        }
    }
}
